import config from './yb_config.js'
export const myRequest = (url,data={},method='POST')=>{
	return new Promise((resolve,reject)=>{
		//1.new Promise初始化promise实例的状态为pending
		uni.request({
			withCredentials: true,
			header:{
				'content-type': 'application/x-www-form-urlencoded',
			},
			url: config.host +url,
			data,
			method,
			success:(res)=>{
				resolve(res) //resolve修改promise的状态为成功状态resolved
			},
			fail:(err)=>{
				reject(err) //reject修改promise的状态为失败状态reject
			}
		})
	})
}